﻿using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sharp.Domain.PlatformBoundedContext.WorkFlowModule.Aggregates;

namespace Sharp.Domain.PlatformBoundedContext.ModelConfigurations.Workflow
{
    public partial class ActivityInstanceEntityConfiguration
        : EntityTypeConfiguration<ActivityInstanceEntity >
    {
        public ActivityInstanceEntityConfiguration()
        {
            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);


            HasMany(t => t.Tasks)
                      .WithRequired(t => t.ActivityInstance)
                      .HasForeignKey(d => d.ActivityInstanceID);


            //HasMany(t => t.ProcessInstances)
            //    .WithRequired(t => t.ActivityInstance);
            //.HasForeignKey(d => d.ProcessInstanceID);
            //外键未定
        }
    }
}